import React from 'react';
import { Text, View } from 'react-native';
import { createBottomTabNavigator, createAppContainer ,createStackNavigator,
createMaterialBottomTabNavigator,createMaterialTopTabNavigator
} from 'react-navigation';
import MaterialTopTabNavigator from './toptab'

class HomeScreen extends React.Component {
//    static navigationOptions = {
//
//        tabBarLabel: '家',
////        tabBarIcon:<Image style={{height: 30, width: 30}}
////                          source={require('./ic_tab_mine.png')}/>
//    };

  render() {
    return (
      <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
        <Text>Home!</Text>
      </View>
    );
  }
}

class SettingsScreen extends React.Component {
  render() {
    return (
      <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
        <Text>Settings!</Text>
      </View>
    );
  }
}

//const TabNavigator = createBottomTabNavigator({
//  Home: HomeScreen,
//  Settings: SettingsScreen,
//  TopTab : MaterialTopTabNavigator
//});

class RootDiy extends React.Component {

    static CreateRoute(){
    // 可以动态生成 并 修改路由配置
    const Home = createStackNavigator({ HomeScreen });
    Home.navigationOptions = {
      tabBarLabel: '家!',
    };

      return (     createBottomTabNavigator({
              Home: Home,
              Settings: SettingsScreen,
              TopTab : MaterialTopTabNavigator
            })
            );
    }

}

const AppTab = createAppContainer(RootDiy.CreateRoute());
export default AppTab